home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / c / qtools0.2-src.lha / src / libqtools / database.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-13  |  3.0 KB  |  104 lines

  1. #ifndef    WAD_H
  2. #define    WAD_H
  3.  
  4. #define    MAX_MULTIPLE    32
  5.  
  6. /*
  7.  * ============================================================================
  8.  * structures
  9.  * ============================================================================
  10.  */
  11.  
  12. struct alist {
  13.   /* link hook for the lists */
  14.   struct nnode listNode;
  15.   /* standard list-header */
  16.   struct nlist listHeader;
  17.   /* filetype of this list
  18.    * there exists a listheader for every filetype
  19.    * linked together by a rootlistheader */
  20.   filetype listType;
  21. };
  22.  
  23. struct anode {
  24.   /* standard list-node */
  25.   struct nnode Node;
  26.   /* pointer to the name, aliasname, filename */
  27.   char *aliasname;                        /* "WeirdSound" */
  28.   char *name;                            /* "sound/ambient/weirdwav" */
  29.   char *filename;                        /* "Quake:id1/pak0.pak$sound/ambient/weirdwav" */
  30. };
  31.  
  32. struct db {
  33.   /*
  34.    * the names could point to real filenames
  35.    * depend on the filetype we search through all
  36.    * path set in the environment
  37.    * the format of the location is <path>/<file>
  38.    */
  39.   char *dirPath[MAX_MULTIPLE + 1];
  40.   DIR *dirDir[MAX_MULTIPLE + 1];
  41.   int dirAvail = 0;
  42.  
  43.   /*
  44.    * the names could point to pak-files
  45.    * depend on the filetype we search through all
  46.    * pak-files set in the environment
  47.    * the format of the location is <path>/<file>$<pakpath>/<pakfile>
  48.    */
  49.   struct pakheader pakHeader[MAX_MULTIPLE + 1];
  50.   struct pakentry *pakEntries[MAX_MULTIPLE + 1];
  51.   char *pakPath[MAX_MULTIPLE + 1];
  52.   HANDLE pakFile[MAX_MULTIPLE + 1];
  53.   int pakAvail = 0;
  54.  
  55.   /*
  56.    * the names could point to wad-files
  57.    * depend on the filetype we search through all
  58.    * wad-files set in the environment
  59.    * the format of the location is <path>/<file>$<wadpath>/<wadfile>
  60.    */
  61.   struct wadheader wadHeader[MAX_MULTIPLE + 1];
  62.   struct wadentry *wadEntries[MAX_MULTIPLE + 1];
  63.   char *wadPath[MAX_MULTIPLE + 1];
  64.   HANDLE wadFile[MAX_MULTIPLE + 1];
  65.   int wadAvail = 0;
  66.  
  67.   /*
  68.    * add bsp-files too?
  69.    */
  70.  
  71.   /*
  72.    * root-list-header that points to the list-header
  73.    * for every filetype that points to the nodes
  74.    */
  75.   struct nlist aliasList;
  76. };
  77.  
  78. /*
  79.  * ============================================================================
  80.  * globals
  81.  * ============================================================================
  82.  */
  83.  
  84. extern struct db globalDB;
  85.  
  86. /*
  87.  * ============================================================================
  88.  * prototypes
  89.  * ============================================================================
  90.  */
  91.  
  92. char *GetNameEntryDB(struct db *database, char *aliasname);
  93. #define    GetNameEntry(aliasname)        GetNameEntryDB(&globalDB, aliasname)
  94. char *GetPathEntryDB(struct db *database, char *aliasname);
  95. #define    GetPathEntry(aliasname)        GetPathEntryDB(&globalDB, aliasname)
  96. bool LoadDatabaseDB(struct db *database, char *fileName);
  97. #define    LoadDatabase(fileName)        LoadDatabaseDB(&globalDB, fileName)
  98. bool AppendDatabaseDB(struct db *database, char *fileName);
  99. #define    AppendDatabase(fileName)    AppendDatabaseDB(&globalDB, fileName)
  100. bool SaveDatabaseDB(struct db *database, char *fileName);
  101. #define    SaveDatabase(fileName)        SaveDatabaseDB(&globalDB, fileName)
  102.  
  103. #endif
  104.